package com.mega.ebcs.entity;

import java.io.Serializable;

import javax.persistence.Embeddable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

@Embeddable
public class EbcsFormatId implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String id;
	private String exchangeType;// REQUEST / RESPONSE
	public EbcsFormatId(String id, String exchangeType) {
		this.id = id;
		this.exchangeType = exchangeType;
	}
	public EbcsFormatId() {	}
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public void setExchangeType(String exchangeType) {
		this.exchangeType = exchangeType;
	}
	public String getExchangeType() {
		return exchangeType;
	}	
	
	@Override
	public boolean equals(Object other) {
		if ( !(other instanceof EbcsFormatId) ) {
			return false;
		}
		EbcsFormatId castOther = (EbcsFormatId) other;
		return new EqualsBuilder()
			.append(this.getId(), castOther.getId())
			.append(this.getExchangeType(), castOther.getExchangeType())
			.isEquals();
	}
	
	@Override
	public String toString() {
		return new ToStringBuilder(this)
			.append("id", getId())
			.append("exchangeType", getExchangeType())
			.toString();
	}
	
	@Override
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.append(getExchangeType())
			.toHashCode();
	}
	
}
